<template>
  <div>
    <div id="u8194" class="ax_default box_2">
      <div id="u8194_div" class=""></div>
      <div id="u8194_text" class="text">
        <p><span>编辑预约信息</span></p>
      </div>
    </div>
    <div id="div1">
      <p>请编辑预约信息</p>
    </div>
    <div>
      <el-button :plain="true" @click="open2" type="primary">保存</el-button>
    </div>
  </div>
</template>

<script>
// Web 富文本编辑器
import E from "wangeditor";
export default {
  data() {
    return {
      editor: null,
      userinfo: {
        introduce: "",
      },
    };
  },
  methods: {
    open2() {
      this.$message({
        message: "保存成功",
        type: "success",
      });
    },
  },
  created() {
    console.log(this.$eventBus);
  },
  mounted() {
    this.editor = new E("#div1");
    // 或者 const editor = new E( document.getElementById('div1') )
    // 监听编辑器的变化
    this.editor.config.onchange = (newHtml) => {
      this.userinfo.introduce = newHtml;
      // console.log(newHtml);
    };
    this.editor.create();
  },
  beforeDestroy() {
    this.editor = null;
  },
};
</script>

<style lang="scss" scoped>
  @import "./scss/index.scss";
</style>